package com.swyc.osschat.Test.LambdaTest.Controller;

import java.util.List;
import java.util.function.BooleanSupplier;
import java.util.function.DoubleSupplier;
import java.util.function.Supplier;

import com.swyc.osschat.Test.LambdaTest.Bean.Student;

/**
 * Supplier<T>无需提供输入参数，返回一个T类型的执行结果
 * @author zhaol@yunrong.cn
 * @version V2.1
 * @since 2.1.0 2019/8/12 21:36
 */
public class SupplierTest2 {
    public static void main(String[] args) {
        List<Student> students = Student.generateData();
        Supplier<String> supplier = ()-> Student.beanToString(students.get(3));
        System.out.println(supplier.get());
        /** BooleanSupplier不提供输入参数，但是返回boolean结果的函数 */
        BooleanSupplier booleanSupplier = () -> true;
        System.out.println(booleanSupplier.getAsBoolean());
        /** DoubleSupplier */
        DoubleSupplier doubleSupplier = () -> 2.7;
        System.out.println(doubleSupplier.getAsDouble());
    }
}
